package com.zzxy.mvc.controller;

import com.zzxy.mvc.ext.UserExt;
import com.zzxy.mvc.po.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/user")
public class UserAnnoController {
    @RequestMapping("/test")
    public String test(){
        return "redirect:list.do";
    }
    @RequestMapping("list.do")
    public String list(Model model) {
        model.addAttribute("username", "zhangwuji");
        return "/user/userList";
    }

    @RequestMapping("toRegister")
    public String toRegister() {
        return "/user/register";
    }

    @RequestMapping("register")
    public String addUser1(User user, Model model) {
        model.addAttribute("user" , user);
        System.out.println(user);
        return "/user/userList";
    }

    @RequestMapping("register1")
    public String addUser1(UserExt ext, Model model) {
        model.addAttribute("userExt" , ext);
        System.out.println(ext);
        return "/user/userList";
    }
}
